#include "progressbar.h"
#include "ui_progressbar.h"

ProgressBar::ProgressBar(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ProgressBar)
{
    ui->setupUi(this);

    this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    setModal(true);
    this->setAttribute(Qt::WA_QuitOnClose,false);
    ui->m_btnStop->setVisible(false);

   if (parent)
   {
       QPoint parentCenter = parent->geometry().center();
       this->move(parentCenter.x() - this->width() / 2,parentCenter.y() - this->height() / 2);
   }
}

ProgressBar::~ProgressBar()
{
    delete ui;
}

void ProgressBar::setTipText(QString _msg)
{
    ui->m_btnStop->setText(_msg);
}

void ProgressBar::setProgessBarCurValue(int _value)
{
    ui->m_progressBar->setValue(_value);
}

void ProgressBar::setMaxValue(int _value)
{
    ui->m_progressBar->setRange(0,_value);  // 设置进度条的最小值 (min) 和最大值 (max)
}
